Skip to content

fix(cli): refuse a flag where an option's value should be - #707

Merged
moreih29 merged 1 commit into
developfrom
fix/cli-option-dash-value
Nov 19, 2026
Merged

moreih29 merged 1 commit into
developfrom
fix/cli-option-dash-value

Conversation

@moreih29

Copy link
Copy Markdown
Owner

Summary

Windows QA for 0.35.0 found this. PowerShell 5.1 drops an empty argument, so nexus workspace edit X --name '' --json reached the CLI as --name --json, and the workspace was renamed to --json.

parseArgs (shared by every command) already refuses a value option at the end of the line with --name needs a value (an empty one: --name=, which every shell passes). It now gives that same error when the next token starts with --. This covers every string and number option, such as --name, --color and --workspace.

  • A value that really starts with -- can still be given as --name=--value. The parser's header comment now says so.
  • Boolean flags and -- (end of flags) are unchanged.

Test plan

  • One row added to the refused-argv table in tests/unit/main/cli/args.test.ts: --workspace --json.
  • bun test tests/unit/main/cli: 339 pass, 4 skip, 0 fail.
  • biome check on the two files.
  • CI (typecheck, lint, tests)

🤖 Generated with Claude Code

PowerShell 5.1 drops an empty argument, so `nexus workspace edit X --name '' --json`
reached the CLI as `--name --json` and named the workspace "--json". The shared
parser now treats a following `--...` token as a missing value, with the same
"needs a value (an empty one: --name=, ...)" error it gives at the end of the
line. A value that starts with `--` is still given as `--name=--value`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@moreih29
moreih29 merged commit 1996cc3 into develop Nov 19, 2026
7 checks passed
@moreih29
moreih29 deleted the fix/cli-option-dash-value branch November 19, 2026 17:10
@moreih29 moreih29 mentioned this pull request Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant